<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>进制转化</title>
</head>
<body>
    <script>
    var num = 10;
    console.log(num.toString());//"10"
    console.log(num.toString(2));//"1010"
    console.log(num.toString(8));//"12"
    console.log(num.toString(16));//"a"
    var n = 255
    console.log(n.toString(16));//"ff"
    </script>
</body>
</html>